package com.ma4567.remotecontroller.UserManager;

import com.ma4567.remotecontroller.RemoteControllerApplication;

public class User {
    public String name;
    public int Account;
    public String Password;

    public boolean Root;

    public boolean DownloadFile;
    public boolean DeleteFile;
    public boolean UploadFile;

    public boolean RemoteControl;

    public User()
    {

    }

    public User(String name)
    {
        this.Account = RemoteControllerApplication.userManager.GetNewUserAccount();
        this.name = name;
        if("temp_user".equals(name))
        {
            this.name = "NewUser" + Account;
        }
        this.Password = "123456";

        if(name.equals("root"))
        {
            this.Root = true;
            this.DownloadFile = true;
            this.DeleteFile = true;
            this.UploadFile = true;
            this.RemoteControl = true;
        }
        else
        {
            this.Root = false;
            this.DownloadFile = true;
            this.DeleteFile = true;
            this.UploadFile = true;
            this.RemoteControl = true;
        }
    }

    public User(String name, int Account, String Password, boolean Root, boolean DownloadFile, boolean DeleteFile, boolean UploadFile, boolean RemoteControl){
        this.name = name;
        this.Account = Account;
        this.Password = Password;
        this.Root = Root;
        this.DownloadFile = DownloadFile;
        this.DeleteFile = DeleteFile;
        this.UploadFile = UploadFile;
        this.RemoteControl = RemoteControl;
    }

    public String toString(){
        String result = "";
        result += "Name: " + this.Account + "\n"
                + "Password: " + this.Password + "\n"
                + "Root: " + this.Root + "\n"
                + "DownloadFile: " + this.DownloadFile + "\n"
                + "DeleteFile: " + this.DeleteFile + "\n"
                + "UploadFile: " + this.UploadFile + "\n"
                + "RemoteControl: " + this.RemoteControl + "\n";
        return result;
    }

}
